from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.
class UserModel(AbstractUser):
    gender_choices = {
        (0, "男"),
        (1, "女"),
        (2, "保密"),
    }

    mobile = models.CharField(max_length=200, verbose_name="电话号码")
    avatar = models.ImageField(upload_to="avatar/", default="avatar/default.png", verbose_name="用户头像")
    gender = models.SmallIntegerField(choices=gender_choices, null=True, verbose_name="用户性别")
    age = models.IntegerField(null=True, verbose_name="用户年龄")
    class Meta:
        db_table = 'my_user'
        verbose_name_plural = "用户"

# class UserDetail(models.Model):
#     gender_choices = {
#         (0, "男"),
#         (1, "女"),
#         (2, "保密"),
#     }
#
#     avatar = models.ImageField(upload_to="avatar/", default="avatar/default.png", verbose_name="用户头像")
#     gender = models.SmallIntegerField(choices=gender_choices, null=True, verbose_name="用户性别")
#     age = models.IntegerField(null=True, verbose_name="用户年龄")
#     user = models.OneToOneField(to=UserModel, on_delete=models.CASCADE)
#     class Meta:
#         db_table = "userdetail"
#         verbose_name_plural = "用户详情表"
